package com.hxkj.domain.po;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author: chenwei
 * @version: 1.0
 * @datetime: 2018-05-21 17:59:26
 */
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AuthUser implements Serializable {


    private static final long serialVersionUID = -5669807040706730406L;
    // 用户ID
    private Long userId;
    // 用户帐户
    private String userAccount;
    // 用户名
    private String userName;
    // 密码
    private String password;
    // 
    private String salt;
    // 用户状态
    private Byte userStatus;
    // 创建时间
    private Long createTime;
    // 更新时间
    private Long updateTime;
    // 删除标记
    private Integer delTag;
    // 部门编号
    private Long departmentId;
    // 
    private String comment;

    private Byte userType;
    // 凭证
    @JsonIgnore
    private String credentialsSalt;

    //关键字
    private String keyword;


    // 账号到期日期
    private Long expirationTime;

    //站点ID的字符串
    private String siteIds;

    // 站点ID
    private Long siteId;
    // 用户ID字符串
    private String uids;

    // 增加的用户是否已关联角色的标识,0:未关联,,1已关联
    private Integer roleTag;

    // 角色ID
    private Long roleId;

    // 角色类型
    private Long roleType;

    // 新密码
    private String newPassword;

    public Integer getRoleTag() {
        return roleTag;
    }

    public void setRoleTag(Integer roleTag) {
        this.roleTag = roleTag;
    }

    public String getUserAccount() {
        return userAccount;
    }

    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Byte getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Byte userStatus) {
        this.userStatus = userStatus;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getDelTag() {
        return delTag;
    }

    public void setDelTag(Integer delTag) {
        this.delTag = delTag;
    }

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Long getExpirationTime() {
        return expirationTime;
    }

    public void setExpirationTime(Long expirationTime) {
        this.expirationTime = expirationTime;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getSiteIds() {
        return siteIds;
    }

    public void setSiteIds(String siteIds) {
        this.siteIds = siteIds;
    }

    public String getUids() {
        return uids;
    }

    public void setUids(String uids) {
        this.uids = uids;
    }

    public String getCredentialsSalt() {
        if (userAccount != null && salt != null) {
            return userAccount + salt;
        }
        return null;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public Long getSiteId() {
        return siteId;
    }

    public void setSiteId(Long siteId) {
        this.siteId = siteId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Byte getUserType() {
        return userType;
    }

    public void setUserType(Byte userType) {
        this.userType = userType;
    }

    public void setCredentialsSalt(String credentialsSalt) {
        this.credentialsSalt = credentialsSalt;
    }

    public String getNewPassword() {
        return newPassword;
    }

    public void setNewPassword(String newPassword) {
        this.newPassword = newPassword;
    }

    public Long getRoleType() {
        return roleType;
    }

    public void setRoleType(Long roleType) {
        this.roleType = roleType;
    }

    @Override
    public String toString() {
        return "AuthUser{" +
                "userId=" + userId +
                ", userAccount='" + userAccount + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", userStatus=" + userStatus +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", delTag=" + delTag +
                ", departmentId=" + departmentId +
                ", comment='" + comment + '\'' +
                ", userType=" + userType +
                ", credentialsSalt='" + credentialsSalt + '\'' +
                ", keyword='" + keyword + '\'' +
                ", expirationTime=" + expirationTime +
                ", siteIds='" + siteIds + '\'' +
                ", siteId=" + siteId +
                ", uids='" + uids + '\'' +
                ", roleTag=" + roleTag +
                ", roleId=" + roleId +
                ", newPassword='" + newPassword + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AuthUser)) return false;
        AuthUser authUser = (AuthUser) o;
        return Objects.equals(getUserId(), authUser.getUserId()) &&
                Objects.equals(getUserAccount(), authUser.getUserAccount()) &&
                Objects.equals(getUserName(), authUser.getUserName()) &&
                Objects.equals(getPassword(), authUser.getPassword()) &&
                Objects.equals(getSalt(), authUser.getSalt()) &&
                Objects.equals(getUserStatus(), authUser.getUserStatus()) &&
                Objects.equals(getCreateTime(), authUser.getCreateTime()) &&
                Objects.equals(getUpdateTime(), authUser.getUpdateTime()) &&
                Objects.equals(getDelTag(), authUser.getDelTag()) &&
                Objects.equals(getDepartmentId(), authUser.getDepartmentId()) &&
                Objects.equals(getComment(), authUser.getComment()) &&
                Objects.equals(getUserType(), authUser.getUserType()) &&
                Objects.equals(getCredentialsSalt(), authUser.getCredentialsSalt()) &&
                Objects.equals(getKeyword(), authUser.getKeyword()) &&
                Objects.equals(getExpirationTime(), authUser.getExpirationTime()) &&
                Objects.equals(getSiteIds(), authUser.getSiteIds()) &&
                Objects.equals(getSiteId(), authUser.getSiteId()) &&
                Objects.equals(getUids(), authUser.getUids()) &&
                Objects.equals(getRoleTag(), authUser.getRoleTag()) &&
                Objects.equals(getRoleId(), authUser.getRoleId()) &&
                Objects.equals(getNewPassword(), authUser.getNewPassword());
    }

    @Override
    public int hashCode() {

        return Objects.hash(getUserId(), getUserAccount(), getUserName(), getPassword(), getSalt(), getUserStatus(), getCreateTime(), getUpdateTime(), getDelTag(), getDepartmentId(), getComment(), getUserType(), getCredentialsSalt(), getKeyword(), getExpirationTime(), getSiteIds(), getSiteId(), getUids(), getRoleTag(), getRoleId(), getNewPassword());
    }
}
